package com.cans.impl;

import com.cans.api.IObserver;

/**
 * 买大米的人
 *
 * @author shenc
 * @date 2021-11-27 15:00
 **/
public class People implements IObserver {

    /**
     * 监听者名称
     */
    private String peopleName;

    @Override
    public void setName(String name) {
      this.peopleName = name;
    }

    public void setObsName(String obsName) {
        this.peopleName = obsName;
    }

    @Override
    public void receive(String name, String msg) {
        // 接收到通知
        System.out.println("良民: " + this.peopleName + "接收到" + name + "的消息: " + msg);
        // 张三行动
        System.out.println(this.peopleName + ": 带钱去买大米");
    }
}
